﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Leo.Awesome.AppPlatform.Services;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
using Volo.Abp.ObjectMapping;

namespace Leo.Awesome.AppPlatform.Servcies
{
    public class RolesService : ITransientDependency, IRolesService
    {
        private readonly IIdentityUserRepository identityUserRepository;
        private readonly IObjectMapper objectMapper;

        public RolesService(IIdentityUserRepository identityUserRepository, IObjectMapper objectMapper)
        {
            this.identityUserRepository = identityUserRepository;
            this.objectMapper = objectMapper;
        }
        public async Task<List<IdentityUserDto>> GetUserById(Guid id)
        {
            var etites = await identityUserRepository.GetListAsync(roleId: id);
            return objectMapper.Map<List<IdentityUser>, List<IdentityUserDto>>(etites);
        }
    }
}
